{% extends 'usercenter_base.html' %}

{% load staticfiles %}

{% block content_right %}
    <div class="right">
        <div class="personal_des Releasecont">
            <div class="head">
                <h1>我的消息</h1>
            </div>
        </div>

        <div class="personal_des permessage">
            <div class="head">
                <ul class="tab_header messagehead">
                    <li class="active"><a href="/user/message/">个人消息</a></li>
                </ul>
            </div>

            <div class="messagelist">
                {% for message in messages_paginator.object_list %}
                    <div class="messages">
                        <div class="fr">
                            <div class="top"><span class="fl time">{{ message.add_time }}</span><span
                                    class="fr btn foldbtn"></span></div>
                            <p>
                                {{ message.message }}
                            </p>
                        </div>
                    </div>
                {% endfor %}
            </div>

            {# 分页 #}
            {% load i18n %}
            <div class="pageturn">
                <ul class="pagelist">

                    {# 上一页 #}
                    {% if messages_paginator.has_previous %}
                        <li class="long">
                            {# *.querystring 如: 'page=1' #}
                            <a href="?{{ messages_paginator.previous_page_number.querystring }}">
                                上一页
                            </a>
                        </li>
                    {% endif %}

                    {# 分页主体 #}
                    {% for page in messages_paginator.pages %}
                        {# p.pages返回如: 1, 2, None, 5, 6, None, 9 #}
                        {% if page %}
                            {# 当前页面高亮显示 #}
                            <li{% if page == messages_paginator.number %} class="active"{% endif %}>
                                <a href="?{{ page.querystring }}">
                                    {{ page }}
                                </a>
                            </li>
                        {% else %}
                            <li>...</li>
                        {% endif %}
                    {% endfor %}

                    {# 下一页 #}
                    {% if messages_paginator.has_next %}
                        <li class="long">
                            <a href="?{{ messages_paginator.next_page_number.querystring }}">
                                下一页
                            </a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>

    </div>
{% endblock %}
